Skip to content

Conversation

kazutakahirata
Copy link
Contributor

@kazutakahirata kazutakahirata commented Sep 14, 2025

This patch ensures that both DenseMap and SmallDenseMap have:

explicit DenseMap(unsigned NumElementsToReserve = 0) {
init(NumElementsToReserve);
}

for consistency and clarity (modulo the class name, of course).

We now have:

  explicit SmallDenseMap(unsigned NumElementsToReservre = 0) {
    init(NumElementsToReservre);
  }

This patch adjusts the variable name in the DenseMap counterpart for
consistency and clarity.
@llvmbot
Copy link
Member

llvmbot commented Sep 14, 2025

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

Changes

We now have:

explicit SmallDenseMap(unsigned NumElementsToReservre = 0) {
init(NumElementsToReservre);
}

This patch adjusts the variable name in the DenseMap counterpart for
consistency and clarity.


Full diff: https://github.com/llvm/llvm-project/pull/158501.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/DenseMap.h (+5-3)
diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index b478ce21d79e6..3226eeaea7d0b 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -710,9 +710,11 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
   unsigned NumBuckets;
 
 public:
-  /// Create a DenseMap with an optional \p InitialReserve that guarantee that
-  /// this number of elements can be inserted in the map without grow()
-  explicit DenseMap(unsigned InitialReserve = 0) { init(InitialReserve); }
+  /// Create a DenseMap with an optional \p NumElementsToReservre to guarantee
+  /// that this number of elements can be inserted in the map without grow().
+  explicit DenseMap(unsigned NumElementsToReservre = 0) {
+    init(NumElementsToReservre);
+  }
 
   DenseMap(const DenseMap &other) : BaseT() {
     init(0);

@kazutakahirata kazutakahirata changed the title [ADT] Adjust a comment for one of the DenseMap constructors (NFC) [ADT] Adjust a parameter name for one of the DenseMap constructors (NFC) Sep 14, 2025
@kazutakahirata kazutakahirata changed the title [ADT] Adjust a parameter name for one of the DenseMap constructors (NFC) [ADT] Adjust parameter names for DenseMap constructors (NFC) Sep 14, 2025
@kazutakahirata kazutakahirata merged commit 885546c into llvm:main Sep 14, 2025
9 of 10 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250914_ADT_DenseMap_comment branch September 14, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants